<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0" />
		<title>修改密码</title>
		<link rel="stylesheet" href="__PUBLIC__/Home/css/common.css">
		<link rel="stylesheet" href="__PUBLIC__/Home/css/main.css">
		<script src="__PUBLIC__/Home/js/zepto.js"></script>
<script src="__PUBLIC__/Home/js/jquery-1.8.3.min.js"></script>
	</head>
	<body>
		<!-- 提示框 -->
		<div class="textTip" style="opacity:0;display: none;"></div>
		<!--正文区域-->
		<div id="gaiPwdTop" class="topBackTitle">
			<div class="contain maxWidth">
				<a class="hz back" href="javascript:;">&#xe600;</a>修改密码
			</div>
		</div>
		<div id="gaiPwdMain" class="fastscroll ownZiliao">
			<div class="contain maxWidth">
				<div class="inputs">
					<div class="inputArea">
						<span>原密码</span><input type="password" placeholder="请输入原密码" id="old_pass">
					</div>
					<div class="inputArea">
						<span>新密码</span><input type="password" placeholder="请输入新密码" id="new_pass">
					</div>
					<div class="inputArea">
						<span>确认密码</span><input type="password" placeholder="请确认新密码" id="new_pass_1">
					</div>
				</div>
				<button class="submitbtn">确认</button>
			</div>
		</div>

		<script>
			//返回按钮
			$('#gaiPwdTop .back').on('tap',function(){
				//window.history.go(-1);
				window.location.href='{:U('Index/baseinfo')}';
			});

			//点击确定
			$('#gaiPwdMain button').on('tap',function(){
				//onsole.log('确认');
				if($("#old_pass").val()=='')
				{
					// alert('请填写原密码!');
					$('.textTip').text('请填写原密码!').css({
								'opacity':1,
								'display':'block'
							});
							setTimeout(function(){
								$('.textTip').css('opacity',0);
								setTimeout(function(){
									$('.textTip').css('display','none');
								},500);
							},1500);
				}
				else if($('#new_pass').val()=='')
				{
					// alert('请填写新密码!');
					$('.textTip').text('请填写新密码!').css({
								'opacity':1,
								'display':'block'
							});
							setTimeout(function(){
								$('.textTip').css('opacity',0);
								setTimeout(function(){
									$('.textTip').css('display','none');
								},500);
							},1500);
				}else if($('#new_pass').val()!=$('#new_pass_1').val())
				{
					// alert('两次密码不一致!');
					$('.textTip').text('两次密码不一致!').css({
								'opacity':1,
								'display':'block'
							});
							setTimeout(function(){
								$('.textTip').css('opacity',0);
								setTimeout(function(){
									$('.textTip').css('display','none');
								},500);
							},1500);
				}else
				{
					$.ajax({  
						type:'post',  
						url:"{:U('Index/updatepass')}",  
						data:{'old_pass':$("#old_pass").val(),'new_pass':$('#new_pass').val()},  
						success:function(data){
							// alert(data.info);
							$('.textTip').text(data.info).css({
								'opacity':1,
								'display':'block'
							});
							setTimeout(function(){
								$('.textTip').css('opacity',0);
								setTimeout(function(){
									$('.textTip').css('display','none');
								},500);
							},1500);
						}  
					});
				}
			});
		</script>
	</body>
</html>
